#include <cstring>
#include "BulletCollision/Gimpact/gim_box_collision.h"
#ifdef __cplusplus
extern "C" {
#endif
GIM_BOX_BOX_TRANSFORM_CACHE* bullet_NewGIM_BOX_BOX_TRANSFORM_CACHE(){
	GIM_BOX_BOX_TRANSFORM_CACHE* wrap_out = new GIM_BOX_BOX_TRANSFORM_CACHE();
	return wrap_out;
}

GIM_BOX_BOX_TRANSFORM_CACHE* bullet_NewGIM_BOX_BOX_TRANSFORM_CACHE1(double** trans1_to_0){
	mat4f c_arg_trans1_to_0;
    memcpy(c_arg_trans1_to_0[0],trans1_to_0,sizeof c_arg_trans1_to_0);
	GIM_BOX_BOX_TRANSFORM_CACHE* wrap_out = new GIM_BOX_BOX_TRANSFORM_CACHE(c_arg_trans1_to_0);
	return wrap_out;
}

void bullet_GIM_BOX_BOX_TRANSFORM_CACHE_calc_absolute_matrix(GIM_BOX_BOX_TRANSFORM_CACHE* c_this){
	c_this->calc_absolute_matrix();
}

void bullet_GIM_BOX_BOX_TRANSFORM_CACHE_calc_from_full_invert(GIM_BOX_BOX_TRANSFORM_CACHE* c_this,btTransform* trans0,btTransform* trans1){
	btTransform const& c_arg_trans0=(btTransform const&)(*trans0);
	btTransform const& c_arg_trans1=(btTransform const&)(*trans1);
	c_this->calc_from_full_invert(c_arg_trans0,c_arg_trans1);
}

void bullet_GIM_BOX_BOX_TRANSFORM_CACHE_calc_from_homogenic(GIM_BOX_BOX_TRANSFORM_CACHE* c_this,btTransform* trans0,btTransform* trans1){
	btTransform const& c_arg_trans0=(btTransform const&)(*trans0);
	btTransform const& c_arg_trans1=(btTransform const&)(*trans1);
	c_this->calc_from_homogenic(c_arg_trans0,c_arg_trans1);
}

btMatrix3x3* bullet_GIM_BOX_BOX_TRANSFORM_CACHE_GetFieldOfM_AR(GIM_BOX_BOX_TRANSFORM_CACHE* c_this){
	return (btMatrix3x3*)(&c_this->m_AR);
}

btMatrix3x3* bullet_GIM_BOX_BOX_TRANSFORM_CACHE_GetFieldOfM_R1to0(GIM_BOX_BOX_TRANSFORM_CACHE* c_this){
	return (btMatrix3x3*)(&c_this->m_R1to0);
}

btVector3* bullet_GIM_BOX_BOX_TRANSFORM_CACHE_GetFieldOfM_T1to0(GIM_BOX_BOX_TRANSFORM_CACHE* c_this){
	return (btVector3*)(&c_this->m_T1to0);
}

btVector3* bullet_GIM_BOX_BOX_TRANSFORM_CACHE_transform(GIM_BOX_BOX_TRANSFORM_CACHE* c_this,btVector3* point){
	btVector3 const& c_arg_point=(btVector3 const&)(*point);
	btVector3 c_out = c_this->transform(c_arg_point);
	btVector3* wrap_out = new btVector3(c_out);
	return wrap_out;
}

GIM_AABB* bullet_NewGIM_AABB(){
	GIM_AABB* wrap_out = new GIM_AABB();
	return wrap_out;
}

GIM_AABB* bullet_NewGIM_AABB1(btVector3* V1,btVector3* V2,btVector3* V3){
	btVector3 const& c_arg_V1=(btVector3 const&)(*V1);
	btVector3 const& c_arg_V2=(btVector3 const&)(*V2);
	btVector3 const& c_arg_V3=(btVector3 const&)(*V3);
	GIM_AABB* wrap_out = new GIM_AABB(c_arg_V1,c_arg_V2,c_arg_V3);
	return wrap_out;
}

GIM_AABB* bullet_NewGIM_AABB2(btVector3* V1,btVector3* V2,btVector3* V3,double margin){
	btVector3 const& c_arg_V1=(btVector3 const&)(*V1);
	btVector3 const& c_arg_V2=(btVector3 const&)(*V2);
	btVector3 const& c_arg_V3=(btVector3 const&)(*V3);
	btScalar c_arg_margin=margin;
	GIM_AABB* wrap_out = new GIM_AABB(c_arg_V1,c_arg_V2,c_arg_V3,c_arg_margin);
	return wrap_out;
}

GIM_AABB* bullet_NewGIM_AABB3(GIM_AABB* other){
	GIM_AABB const& c_arg_other=(GIM_AABB const&)(*other);
	GIM_AABB* wrap_out = new GIM_AABB(c_arg_other);
	return wrap_out;
}

GIM_AABB* bullet_NewGIM_AABB4(GIM_AABB* other,double margin){
	GIM_AABB const& c_arg_other=(GIM_AABB const&)(*other);
	btScalar c_arg_margin=margin;
	GIM_AABB* wrap_out = new GIM_AABB(c_arg_other,c_arg_margin);
	return wrap_out;
}

void bullet_GIM_AABB_appy_transform(GIM_AABB* c_this,btTransform* trans){
	btTransform const& c_arg_trans=(btTransform const&)(*trans);
	c_this->appy_transform(c_arg_trans);
}

bool bullet_GIM_AABB_collide_plane(GIM_AABB* c_this,btVector4* plane){
	btVector4 const& c_arg_plane=(btVector4 const&)(*plane);
	bool c_out = c_this->collide_plane(c_arg_plane);
	bool wrap_out = (c_out);
	return wrap_out;
}

bool bullet_GIM_AABB_collide_ray(GIM_AABB* c_this,btVector3* vorigin,btVector3* vdir){
	btVector3 const& c_arg_vorigin=(btVector3 const&)(*vorigin);
	btVector3 const& c_arg_vdir=(btVector3 const&)(*vdir);
	bool c_out = c_this->collide_ray(c_arg_vorigin,c_arg_vdir);
	bool wrap_out = (c_out);
	return wrap_out;
}

bool bullet_GIM_AABB_collide_triangle_exact(GIM_AABB* c_this,btVector3* p1,btVector3* p2,btVector3* p3,btVector4* triangle_plane){
	btVector3 const& c_arg_p1=(btVector3 const&)(*p1);
	btVector3 const& c_arg_p2=(btVector3 const&)(*p2);
	btVector3 const& c_arg_p3=(btVector3 const&)(*p3);
	btVector4 const& c_arg_triangle_plane=(btVector4 const&)(*triangle_plane);
	bool c_out = c_this->collide_triangle_exact(c_arg_p1,c_arg_p2,c_arg_p3,c_arg_triangle_plane);
	bool wrap_out = (c_out);
	return wrap_out;
}

void bullet_GIM_AABB_copy_with_margin(GIM_AABB* c_this,GIM_AABB* other,double margin){
	GIM_AABB const& c_arg_other=(GIM_AABB const&)(*other);
	btScalar c_arg_margin=margin;
	c_this->copy_with_margin(c_arg_other,c_arg_margin);
}

void bullet_GIM_AABB_find_intersection(GIM_AABB* c_this,GIM_AABB* other,GIM_AABB* intersection){
	GIM_AABB const& c_arg_other=(GIM_AABB const&)(*other);
	GIM_AABB& c_arg_intersection=(GIM_AABB&)(*intersection);
	c_this->find_intersection(c_arg_other,c_arg_intersection);
}

void bullet_GIM_AABB_get_center_extend(GIM_AABB* c_this,btVector3* center,btVector3* extend){
	btVector3& c_arg_center=(btVector3&)(*center);
	btVector3& c_arg_extend=(btVector3&)(*extend);
	c_this->get_center_extend(c_arg_center,c_arg_extend);
}

btVector3* bullet_GIM_AABB_GetFieldOfM_max(GIM_AABB* c_this){
	return (btVector3*)(&c_this->m_max);
}

btVector3* bullet_GIM_AABB_GetFieldOfM_min(GIM_AABB* c_this){
	return (btVector3*)(&c_this->m_min);
}

bool bullet_GIM_AABB_has_collision(GIM_AABB* c_this,GIM_AABB* other){
	GIM_AABB const& c_arg_other=(GIM_AABB const&)(*other);
	bool c_out = c_this->has_collision(c_arg_other);
	bool wrap_out = (c_out);
	return wrap_out;
}

void bullet_GIM_AABB_increment_margin(GIM_AABB* c_this,double margin){
	btScalar c_arg_margin=margin;
	c_this->increment_margin(c_arg_margin);
}

void bullet_GIM_AABB_invalidate(GIM_AABB* c_this){
	c_this->invalidate();
}

void bullet_GIM_AABB_merge(GIM_AABB* c_this,GIM_AABB* box){
	GIM_AABB const& c_arg_box=(GIM_AABB const&)(*box);
	c_this->merge(c_arg_box);
}

bool bullet_GIM_AABB_overlapping_trans_cache(GIM_AABB* c_this,GIM_AABB* box,GIM_BOX_BOX_TRANSFORM_CACHE* transcache,bool fulltest){
	GIM_AABB const& c_arg_box=(GIM_AABB const&)(*box);
	GIM_BOX_BOX_TRANSFORM_CACHE const& c_arg_transcache=(GIM_BOX_BOX_TRANSFORM_CACHE const&)(*transcache);
	bool c_arg_fulltest=fulltest;
	bool c_out = c_this->overlapping_trans_cache(c_arg_box,c_arg_transcache,c_arg_fulltest);
	bool wrap_out = (c_out);
	return wrap_out;
}

bool bullet_GIM_AABB_overlapping_trans_conservative(GIM_AABB* c_this,GIM_AABB* box,btTransform* trans1_to_0){
	GIM_AABB const& c_arg_box=(GIM_AABB const&)(*box);
	btTransform& c_arg_trans1_to_0=(btTransform&)(*trans1_to_0);
	bool c_out = c_this->overlapping_trans_conservative(c_arg_box,c_arg_trans1_to_0);
	bool wrap_out = (c_out);
	return wrap_out;
}

ePLANE_INTERSECTION_TYPE bullet_GIM_AABB_plane_classify(GIM_AABB* c_this,btVector4* plane){
	btVector4 const& c_arg_plane=(btVector4 const&)(*plane);
	ePLANE_INTERSECTION_TYPE c_out = c_this->plane_classify(c_arg_plane);
	ePLANE_INTERSECTION_TYPE wrap_out = (c_out);
	return wrap_out;
}

void bullet_GIM_AABB_projection_interval(GIM_AABB* c_this,btVector3* direction,double* vmin,double* vmax){
	btVector3 const& c_arg_direction=(btVector3 const&)(*direction);
	btScalar& c_arg_vmin=(btScalar&)(*vmin);
	btScalar& c_arg_vmax=(btScalar&)(*vmax);
	c_this->projection_interval(c_arg_direction,c_arg_vmin,c_arg_vmax);
}

#ifdef __cplusplus
}
#endif
